<?php

namespace app\shopapi\controller;


use app\admin\model\shop\Config;

use app\common\controller\Shopapi;
use app\shopapi\model\ShopBills;


/**
 * 收款账户
 */
class Bank extends Shopapi
{
    //protected $noNeedLogin = ['*'];
    protected $noNeedRight = '*';

    //配置
    public function config()
    {
        $config = Config::field('kefu_img,collection_limit')->find(1);
        $this->success('',$config);
    }

    //结算卡信息
    public function settlementCard()
    {
        $shop = \app\shopapi\model\Shop::where(['shop_id'=>$this->shopauth->shop_id])
            ->field('shop_id,bank_num,bank_name,bank_card_id')->find();
        $this->success('',$shop);
    }


    //到账记录'
    public function arrivalRecord()
    {
        try {
            $params = input();
            $bills_model = new ShopBills();

            $lists = $bills_model->arrivalRecord($this->shopauth->shop_id,$params);
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('',$lists);
    }

    //导出
    public function export()
    {
        try {
            $params = input();
            $bills_model = new ShopBills();

            $lists = $bills_model->exportArrivalRecord($this->shopauth->shop_id,$params);
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('',$lists);
    }

}